package com.example.design.shejimoshi.action.strategy.注解with策略模式;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @Description TODO
 * @date 2022/11/11 11:19
 * @Author liuzhihui
 * @Version 1.0
 */
@Service
public class OrderService {
    @Autowired
    OrderHandlerFactory orderHandlerFactory;

    public void orderService(Order order) {
        // 一些前置处理...

        OrderHandler orderHandler = orderHandlerFactory.getOrderHandlerMap().get(order.getSource());
        orderHandler.handle(order);

        // 一些后置处理
    }


}
